from flask import Flask
import redis

app = Flask(__name__)

from user import user_control
from admin import admin_control

user_control.UserController.user_url(app)
admin_control.AdminController.admin_url(app)

pool = redis.ConnectionPool(host="localhost", port=6379, decode_responses=True)

from utils import utils
import time

params = {
    "TIME_RATE": 300,

    "FAST_POWER_RATE": 30,
    "SLOW_POWER_RATE": 10,

    "F_NUM": 2,
    "T_NUM": 3,

    "CHARGE_LEN": 3,
    "WAIT_LEN": 10,

    "PEEK": 1.0,
    "PLAIN": 0.7,
    "VALLEY": 0.4,
    "SERVICE": 0.8,

    "STRATEGY": 1,
}
utils.set_params(params)

utils.set_system_time()
utils.init_stations()

# while True:
#     if input():
#         now = utils.get_system_time()
#         print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(now)))
#         struct_time = time.localtime(now)
#         print(struct_time.tm_hour, struct_time.tm_min)
print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(1654062322.3166943)))
print(utils.get_order_cost("F", 13, 45, 16, 45))
app.run(debug=True)

